/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package travelexperts;

import java.math.BigDecimal;
import org.jdesktop.beansbinding.Converter;

/**
 *
 * @author Administrator
 */
    public class currencyConvert extends Converter<BigDecimal, String> {
    @Override   
    public String convertForward(BigDecimal arg) {
       return  "$"+String.format("%.2f", arg);
        
    }
    @Override
        public BigDecimal convertReverse(String arg) {
        BigDecimal value;
        try {
            BigDecimal money = new BigDecimal(arg.replaceAll(",", ""));
            value = money;
        } catch (NumberFormatException ex) {
            value = null;
        }
        return value;
    }
}
